<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<% String path = request.getContextPath(); %>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c"%>
<%@ taglib uri="/WEB-INF/tld/ui.tld" prefix="ui"%>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="renderer" content="webkit">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>垫款规则详情</title>
<jsp:include page="../../import.jsp" flush="true" />
<style>
.moreGps {
	width: 398px;
	-moz-border-radius: 4px;
	-webkit-border-radius: 4px;
	-ms-border-radius: 4px;
	-khtml-border-radius: 4px;
	border-radius: 4px;
}
.ui-textbox{
	position: relative;
	border: 1px solid #e9e9e9;
	height: 18px;
	line-height: 18px;
	width: 130px;
	border-radius: 4px;
}
</style>
</head>
<body class="iframeBody">
	<div class="Wrapper">
        <div id="changeBank_Html">
		    <form id="changeRule_form">
		                <div class="fieldset1 tabel_col clearFix">
		                	<div class="fieldBox col_100">
		                		基本信息：
		                    </div>
		                    <div class="fieldBox col_100">
		                        <div class="label">规则名称</div>
		                        <div class="field">
		                       		<input name="ruleNm" id="ruleNmUp" type="text" class="ui-textbox" readonly="readonly">
		                        </div>
		                    </div>

							<div class="fieldBox col_50">
								<div class="label">垫款类型</div>
								<div class="field">
									<select name="dkStyleCd" id="dkStyleCdUp" class="ui-textbox">
										<option value="" selected="selected">--请选择--</option>
										<option value="1">明垫</option>
										<option value="0">暗垫</option>
									</select>
								</div>
							</div>

		                    <div class="fieldBox col_50">
		                        <div class="label">再融资项目</div>
		                        <div class="field">
		                        	<input name="refPrjId" id="refPrjIdUp" type="hidden" class="ui-textbox">
		                        	<input name="jgNoId" id="jgNoIdUp" type="hidden" class="ui-textbox">
		                        	<input name="refPrjNm" id="refPrjNmUp" readonly= "true" type="text" class="ui-textbox">
		                        </div>
		                    </div>
		
							<div class="fieldBox col_50">
		                        <div class="label">收款账户</div>
		                        <div class="field">
		                       		 <select name="accTypCd" id="accTypCdUp" class="ui-textbox">
		                                 <option value="" selected="selected">--请选择--</option>
		                                 <option value="1">承租人账户</option>
		                                 <option value="2">我司账户</option>
		                                 <option value="3">机构账户</option>
										  <option value="4">无</option>
		                             </select>
		                        </div>
		                    </div>
		                    
		                   <div class="fieldBox col_50">
		                        <div class="label">账户信息</div>
		                        <div class="field">
		                        	<input name="accId-2" id="accId-2-Id-Up" type="hidden" class="ui-textbox">
		                        	<input name="accNum-2" id="accId-2-Up" type="text" readonly= "true" style="display:none" class="ui-textbox">
		                        	
		                        	<!-- 机构账户 -->
	                        		<input name="accId-3" id="accId-3-Id-Up" type="hidden" class="ui-textbox">
	                        		<input name="accNum-3" id="accId-3-Up" type="text" readonly= "true" style="display:none" class="ui-textbox">
	                        		
	                        		<input name="accountTypCd" id="up_accTypCd" type="hidden" class="ui-textbox">
	                        		<input name="bkNm" id="up_bkNm" type="hidden" class="ui-textbox">
	                        		<input name="bkNo" id="up_bkNo" type="hidden" class="ui-textbox">
	                        		<input name="rcptUnt" id="up_rcptUnt" type="hidden" class="ui-textbox">
		                        </div>
		                    </div>
		                    
		                   <div class="fieldBox col_50">
		                        <div class="label">最高垫款次数（累计）</div>
		                        <div class="field">
		                       	 	<input name="totalMaxQty" id="totalMaxQtyUp" type="text" class="ui-textbox">
		                       	 	<input type="checkbox" name="totalMaxQtyCh" id="totalMaxQtyChUp" /> 无限制
		                        </div>
		                    </div>
		                    
		                    <div class="fieldBox col_50">
		                        <div class="label">最高垫款次数（单资产）</div>
		                        <div class="field">
		                        	<input name="singleMaxQty" id="singleMaxQtyUp" type="text" class="ui-textbox">
		                        	<input type="checkbox" name="singleMaxQtyCh" id="singleMaxQtyChUp" /> 无限制
		                        </div>
		                    </div>
		                    
							<div class="fieldBox col_50">
		                        <div class="label">赎回执行</div>
		                        <div class="field">
		                        		<select name="ransomExecCd" id="ransomExecCdUp" class="ui-textbox">
		                                 <option value="" selected="selected">--请选择--</option>
		                                 <option value="1">标记赎回</option>
		                                 <option value="2">生成小贷账单</option>
		                             </select>
		                        </div>
		                    </div>


							<div class="fieldBox col_50">
								<div class="label">是否资管业务</div>
								<div class="field">
									<select name="isAssBiz" id="isAssBizUp" class="ui-textbox">
										<option value="" selected="selected">--请选择--</option>
										<option value="1">是</option>
										<option value="0">否</option>
									</select>
								</div>
							</div>

							<%--<div class="fieldBox col_33" id="searchInsCodeId">
								<div class="label">第三方机构</div>
								<div class="field">
									<select name="thdOrgCd"  id="thdOrgCdUp" class="ui-textbox">
										<option value="  " selected="selected">--请选择--</option>
										<c:forEach items="${friBaseList}" var="fri">
											<option value="${fri.insCode}">${fri.fundRasInsNm}</option>
										</c:forEach>
									</select>
								</div>
							</div>--%>
							<div class="fieldBox col_50" id="searchInsCodeId">
								<div class="label">第三方机构</div>
								<div class="field">
									<select name="thdOrgCd"  id="thdOrgCdUp" class="ui-textbox">
										<option value="  " selected="selected">--请选择--</option>
										<c:forEach items="${friBaseList}" var="fri">
											<option value="'${fri.insCode}_${fri.id}'">${fri.fundRasInsNm}</option>
										</c:forEach>
									</select>
								</div>
							</div>
							<div class="fieldBox col_50" >
								<div class="label">起租日</div>
								<div class="field">
									<input name="lsDtStart" id="lsDtStart" type="text" value="">
									<span>--</span>
									<input name="lsDtEnd" id="lsDtEnd" type="text"  value="">
								</div>
							</div>

		
							<div class="fieldBox col_100">
		                		逾期天数垫款目标：
		                    </div>
		
							<div class="fieldBox col_50">
		                        <div class="label">起垫逾期天数（含）</div>
		                        <div class="field">
		                        	<input name="startOvedayDays" id="startOvedayDaysUp" type="text" class="ui-textbox" readonly="readonly">
		                        </div>
		                    </div>
		                     <div class="fieldBox col_50">
		                        <div class="label">最高逾期天数（含）</div>
		                        <div class="field">
		                        	<input name="endOvedayDays" id="endOvedayDaysUp" type="text" class="ui-textbox" readonly="readonly">
		                        </div>
		                    </div>
		                </div>
	            </form>
		</div> 
	</div>
</body>

<script type="text/javascript">
	var gridPrj = null;
	$(function () {
        $("#lsDtStart").ligerDateEditor();
        $("#lsDtEnd").ligerDateEditor();
		var id = '${id}';
		if(!id)return;
		$.ajax({
			type: 'get',
			dataType:'json',
			data:{id:id},
			url: '<%=path%>/dk/dkruleinfo/getById.do',
			success:function(msg){
				if(msg.success == 1){
					setData(msg.data);//设置数据
				 }else{
					 $.ligerDialog.SQalert({content:msg.info, SQ_type: "error"});
				 }
			}
		});
	});
	
	//设置页面数据
	function setData(data){
		$("#ruleNmUp").val(data.ruleNm);
		$("#refPrjIdUp").val(data.refPrjId);
		$("#refPrjNmUp").val(data.refPrjNm);
		$("#accTypCdUp").val(data.accTypCd);
		$("#ransomExecCdUp").val(data.ransomExecCd);

		$("#dkStyleCdUp").val(data.dkStyleCd);
		$("#isAssBizUp").val(data.isAssBiz);
		$("#lsDtStart").ligerGetDateEditorManager().setValue(data.lsDtStart);
		$("#lsDtEnd").ligerGetDateEditorManager().setValue(data.lsDtEnd);

		/*$("#thdOrgCdUp option[value= "+ data.thdOrgCd +" ] ").attr("selected",true);*/
		if(data.thdOrgCd == null || data.thdOrgCd == "" || data.thdOrgCd == '') {
			$("#thdOrgCdUp").val("'" + "_" + data.thdOrgId + "'")
		}else {
			$("#thdOrgCdUp").val("'" + data.thdOrgCd + "_" + data.thdOrgId + "'")
		}

		$("#startOvedayDaysUp").val(data.startOvedayDays);
		$("#endOvedayDaysUp").val(data.endOvedayDays);
		
		$("#up_accTypCd").val(data.bkAccTypCd);
		$("#up_bkNm").val(data.payeeBkNm);
		$("#up_bkNo").val(data.payeeBkNo);
		$("#up_rcptUnt").val(data.accNm);

		var dkStyleCd = data.dkStyleCd;
		if(dkStyleCd == "1"){
			$("#refPrjNmUp").hide();
		}else {
			$("#refPrjNmUp").show();
		}

		if(data.totalMaxQty == "-1"){
		  	$("#totalMaxQtyChUp").attr("checked",'true'); 
		  	$("#totalMaxQtyUp").val("");
	    	$("#totalMaxQtyUp").attr("disabled","disabled");
		}else{
			$("#totalMaxQtyUp").val(data.totalMaxQty);
			$("#totalMaxQtyChUp").removeAttr("checked"); 
			$("#totalMaxQtyUp").removeAttr("disabled");
		}
		
		if(data.singleMaxQty == "-1"){
		  	$("#singleMaxQtyChUp").attr("checked",'true'); 
		  	$("#singleMaxQtyUp").val("");
	    	$("#singleMaxQtyUp").attr("disabled","disabled");
		}else{
			$("#singleMaxQtyUp").val(data.singleMaxQty);
			$("#singleMaxQtyChUp").removeAttr("checked"); 
			$("#singleMaxQtyUp").removeAttr("disabled");
		}


		var accTypCd = data.accTypCd;
		 if(accTypCd == "2"){
    		$("#accId-2-Up").show();
    		$("#accId-3-Up").hide();
    		$("#accId-2-Id-Up").val(data.accId);
    		$("#accId-2-Up").val(data.accNum);

    		$("#accId-3-Id-Up").val("");
    		$("#accId-3-Up").val("");
    	}
    	if(accTypCd == "3"){
    		$("#accId-2-Up").hide();
    		$("#accId-3-Up").show();
    		$("#accId-3-Id-Up").val(data.accId);
    		$("#accId-3-Up").val(data.accNum);
    		
    		$("#accId-2-Up").val("");
    		$("#accId-2-Id-Up").val("");
    		// 查询机构号 
    		<%-- $.ajax({
				type: 'get',
				dataType:'json',
				data:{id:data.refPrjId},
				async:false, 
				url: '<%=path%>/dk/dkruleinfo/getPrjById.do',
				success:function(msg){
					if(msg.success == '1'){
						$("#jgNoIdUp").val(msg.data.fncinsid);
	            	}
				}	
			}); --%>
    	}

        $("#dkStyleCdUp").attr("disabled","disabled");
        $("#refPrjIdUp").attr("disabled","disabled");
        $("#refPrjNmUp").attr("disabled","disabled");
        $("#accTypCdUp").attr("disabled","disabled");
        $("#accId-2-Up").attr("disabled","disabled");
        $("#accId-3-Up").attr("disabled","disabled");
        $("#totalMaxQtyUp").attr("disabled","disabled");
        $("#totalMaxQtyChUp").attr("disabled","disabled");
        $("#singleMaxQtyUp").attr("disabled","disabled");
        $("#singleMaxQtyChUp").attr("disabled","disabled");

        $("#ransomExecCdUp").attr("disabled","disabled");
        $("#isAssBizUp").attr("disabled","disabled");
        $("#thdOrgCdUp").attr("disabled","disabled");
	}
	
</script>

</html>